package cn.kgc.shiro.utils;



import java.util.Random;

/**
 * @author 课工场
 * @date 2023/11/21
 * @description  获取随机盐工具类
 */
public class SaltUtil {

    public static  String  getRandomSalt(Integer length){
        char[] charArray = "1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM,.".toCharArray();
        Random random = new Random();
        StringBuilder stringBuilder = new StringBuilder();

        for (Integer integer = 0; integer < length; integer++) {
            int index = random.nextInt(charArray.length);
            stringBuilder.append(charArray[index]);
        }
        return  stringBuilder.toString();
    }

}
